﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Model
{
    [Table("Equipment")]
    public class Equipment
    {
        private int _equipmentId;
        private string _equipmentDescription;
        private string _status;
        private string _communicationStatus;
        private string _lockStatus;
        private string _equipmentStatus;
        private string _equipmentType;
        private string _equipmentModel;
        private string _detailedEquipmentType;
        private int _waitingCapacity;
        private int _processCapacity;
        private int _loadingCapacity;

        // 设备 ID（主键）
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int EquipmentId
        {
            set { _equipmentId = value; }
            get { return _equipmentId; }
        }

        // 设备说明（可空）
        public string EquipmentDescription
        {
            set { _equipmentDescription = value; }
            get { return _equipmentDescription; }
        }

        // 状态（非空）
        [Required]
        [StringLength(50)]
        public string Status
        {
            set { _status = value; }
            get { return _status; }
        }

        // 通信状态（非空，默认接通）
        [Required]
        [StringLength(50)]
        public string CommunicationStatus
        {
            set { _communicationStatus = value; }
            get { return _communicationStatus; }
        }

        // 锁定状态（非空，默认不锁定）
        [Required]
        [StringLength(50)]
        public string LockStatus
        {
            set { _lockStatus = value; }
            get { return _lockStatus; }
        }

        // 设备状态（非空，默认运行）
        [Required]
        [StringLength(50)]
        public string EquipmentStatus
        {
            set { _equipmentStatus = value; }
            get { return _equipmentStatus; }
        }

        // 设备类型（非空）
        [Required]
        [StringLength(255)]
        public string EquipmentType
        {
            set { _equipmentType = value; }
            get { return _equipmentType; }
        }

        // 设备型号（非空）
        [Required]
        [StringLength(255)]
        public string EquipmentModel
        {
            set { _equipmentModel = value; }
            get { return _equipmentModel; }
        }

        // 详细设备类型（非空）
        [Required]
        [StringLength(255)]
        public string DetailedEquipmentType
        {
            set { _detailedEquipmentType = value; }
            get { return _detailedEquipmentType; }
        }

        // 等待容量（非空）
        [Required]
        public int WaitingCapacity
        {
            set { _waitingCapacity = value; }
            get { return _waitingCapacity; }
        }

        // 制程容量（非空）
        [Required]
        public int ProcessCapacity
        {
            set { _processCapacity = value; }
            get { return _processCapacity; }
        }

        // 装载容量（非空）
        [Required]
        public int LoadingCapacity
        {
            set { _loadingCapacity = value; }
            get { return _loadingCapacity; }
        }

        // 构造函数
        public Equipment()
        {
            CommunicationStatus = "接通"; // 默认值
            LockStatus = "不锁定";        // 默认值
            EquipmentStatus = "运行";     // 默认值
        }
    }
}